import { Order } from 'order-model.js';
var order = new Order();
Page({
  data: {

  },
  onLoad: function (options) {
    this.data.id = options.id ? options.id : 74;
    this.data.entry = options.entry ? options.entry : 0;
  },
  onShow: function (options) {
    if (!this.data.id) {
      return false
    }
    this._loadData();
  },
  //加载订单信息
  _loadData: function () {
    var args = {
      order_id: this.data.id
    }
    order.getRefundInfo(args, (data) => {
      var pay_method = '未知方式';
      if (data.payment_code == 'wxMini'){
        var pay_method = '微信支付';
      } else if (data.payment_code == 'money'){
        var pay_method = '余额支付';
      }
      this.setData({
        orderData: data,
        pay_method
      })
    })
  },
  toOrder:function(){
    wx.navigateTo({
      url: 'list',
    })
  },
  onUnload:function(){
    if(this.data.entry==1){
      wx.redirectTo({
        url: 'list',
      })
    }
  }

})